package com.wenda.homeschooedu.model;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.ForeignKey;

/**
 * 学生类
 * _id : 学号
 * name: 姓名
 * sex :性别
 * age :年龄
 * clase_id:班级编号
 * userName:学生用户名
 * phone : 学生电话
 * address: 学生家庭住址
 * @author Administrator
 *
 */
@Entity
@Table(name="student")
public class Student extends BaseModel{
	/**
	 * 
	 */
	private static final long serialVersionUID = 3050042017525677906L;
	private int _id;
	private String name;
	private int sex;
	private int age;
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(nullable=false)
	@ForeignKey(name="classes_id")
	private Classes course;
	private String userName;
	private String phone;
	private String address;
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(nullable=false)
	@ForeignKey(name="parent_id")
	private Parent parent;
	
	
	public int get_id() {
		return _id;
	}

	public void set_id(int _id) {
		this._id = _id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getSex() {
		return sex;
	}

	public void setSex(int sex) {
		this.sex = sex;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}



	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public Classes getCourse() {
		return course;
	}

	public void setCourse(Classes course) {
		this.course = course;
	}

	public Student(){
		
	}
	
	
	

	@Override
	public String toString() {
		return "Student [_id=" + _id + ", name=" + name + ", sex=" + sex
				+ ", age=" + age + ", course=" + course + ", userName=" + userName + ", phone=" + phone
				+ ", address=" + address + "]";
	}

	public Parent getParent() {
		return parent;
	}

	public void setParent(Parent parent) {
		this.parent = parent;
	}

}
